package malitech.yadam.model.acquire;

import java.io.Serializable;
import java.util.Properties;

import malitech.yadam.business.acquire.JobStepRunner;

/**
 * Cet objet définit la base des steps utilisés pour un Job d'import
 * 
 * @author ech
 * 
 */
public class JobStepParameters implements Serializable
{

    private static final long   serialVersionUID        = 1L;
    private static final String namePropertyName        = "Name";
    private static final String descriptionPropertyName = "Description";
    private static final String clazzNamePropertyName   = "ClazzName";

    private JobParameters       parent;
    private String              name;
    private String              description;
    protected String            clazzName;

    protected JobStepRunner           jobStepRunner = null;

    protected static String     StepRunnerBeanName;

    public JobStepParameters()
    {
        this.clazzName = "JobStepParameters";
    }

    public JobStepParameters(JobParameters parent)
    {
        this.parent = parent;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getDescription()
    {
        return description;
    }

    public void setDescription(String description)
    {
        this.description = description;
    }

    /**
     * load this step from the specified properties object
     * 
     * @param properties
     */
    public void load(String prefix, Properties properties)
    {
        String keyName = prefix + "." + namePropertyName;
        this.name = properties.getProperty(keyName);

        keyName = prefix + "." + descriptionPropertyName;
        this.description = properties.getProperty(keyName);
        return;

    }

    /**
     * save this step to the specified properties object
     * 
     * @param properties
     */
    public void save(String prefix, Properties properties)
    {
        String keyName = prefix + "." + namePropertyName;
        properties.put(keyName, this.name);

        keyName = prefix + "." + descriptionPropertyName;
        properties.put(keyName, this.description);

        keyName = prefix + "." + clazzNamePropertyName;
        properties.put(keyName, this.clazzName);
        
        return;

    }

    public String getClazzName()
    {
        return clazzName;
    }

    public void setClazzName(String clazzName)
    {
        this.clazzName = clazzName;
    }

    public JobStepRunner getJobStepRunner()
    {
        return jobStepRunner;
    }

    public JobParameters getParent()
    {
        return parent;
    }

}
